<template>
	<view>
		<web-view :src="pluginUrl"></web-view>
	</view>
</template>

<script>
	export default {
		name: "Plugin",
		data() {
			return {
				pluginUrl: ""
			}
		},
		onLoad(e) {
			uni.setNavigationBarTitle({
				title: '插件页面'
			})
			this.makeUrl(e)
		},
		onBackPress() {
			this.$store.commit('mutationsStatelistStatus', true)
		},
		methods: {
			makeUrl(e) {
				if (!this.$_loginOrNot()) {
					this.$_notLoggedInPrompt()
					return
				}
				e.url = decodeURIComponent(e.url)
				e.url = e.url.replace('{authorization}', this.$_pluginAuthorization())
				e.url = e.url.replace('{type}', e.type)
				e.url = e.url.replace('{scene}', e.scene)
				e.url = e.url.replace('{postMessageKey}', e.postMessageKey)
				e.url = e.url.replace('{uid}', e.uid ?? '')
				e.url = e.url.replace('{pid}', e.pid ?? '')
				e.url = e.url.replace('{cid}', e.cid ?? '')
				this.pluginUrl = e.url
			}
		}
	}
</script>

<style>

</style>